# -*- coding: UTF-8 -*-
# Author: Damon(wuud1)
# CreateDate: 
# Message:

import pymongo
import json

def get_monCol(col):
    monClient = pymongo.MongoClient(host='192.168.10.222', port=27017)
    monDb = monClient["changan_local"]
    monCol = monDb[col]
    return monCol

def tools():
    fd = open('./carCode_clean.py', 'a')
    mongoCol = get_monCol('carCode_clean')
    data = mongoCol.find()
    for info in data:
        info.pop('_id')
        fd.write(json.dumps(info, ensure_ascii=False))
        fd.write('\n')

if __name__ == '__main__':
    tools()